package tr.helper;

import tr.helper.domain.LoginUser;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * tr-service
 *
 * @author MrYe
 * @date 2022-01-12 18:11
 */
@AllArgsConstructor
public class UserHolder {

    @Getter
    private static UserHolder instance;

    @Getter
    private LoginUser user;

    public static UserHolder setSession(LoginUser user) {
        if (instance == null) {
            instance = new UserHolder(user);
        }
        return instance;
    }

    public void clean() {
        this.user = null;
    }

}
